﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="MvcContrib.FluentHtml.ModelViewPage<IEnumerable<Dgg.Anug.Cqrs.Core.Presentation.Models.DefectHandling.Issue>>" %>
<%@ Import Namespace="Dgg.Anug.Cqrs.Core.Presentation.Controllers" %>
<%@ Import Namespace="MvcContrib.UI.DataList" %>

<asp:Content ContentPlaceHolderID="TitleContent" runat="server">
	All Issues
</asp:Content>

<asp:Content ContentPlaceHolderID="MainContent" runat="server">

    <h2>All Issues</h2>

    <% Html.DataList(Model).CellTemplate(item =>
    {%>
		<div class="background withContext <%: item.Status %>" id="<%: item.Id %>">
			<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
				<span class="padded <%: item.Status %>"><%= item.Title %></span>
			<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
		</div>
     <%})
	.EmptyDateSourceTemplate(()=>{%>
		No Issues
	<%}).Render(); %>

	<p>
		<%= Html.ActionLink<IssueController>(c => c.Open(), "Open") %>
	</p>
</asp:Content>

<asp:Content ContentPlaceHolderID="ScriptContent" runat="server">
<script type="text/javascript">
	$(function () {
		var actions = new MenuActionsForIssue(
					'<%=Guid.Empty %>',
					'<%= Html.ActionLink<IssueController>(c => c.Fix(Guid.Empty), "f") %>',
					'<%= Html.BuildUrlFromExpression<IssueController>(c => c.Close(Guid.Empty)) %>',
					'<%= Html.BuildUrlFromExpression<IssueController>(c => c.Delete(Guid.Empty)) %>');

		$('.withContext').contextMenu({ menu: 'issueMenu' },
		function (action, el, pos) {
			actions.performAction(action, $(el).attr('id').toString());
		},
		function (element, menu) { actions.trimActions(element, menu); });
	});
		</script>
		<%Html.RenderPartial("issueMenu"); %>
</asp:Content>

